<!--
 * @Description  : 
 * @Autor        : guoxi
 * @Date         : 2022-07-27 14:30:53
 * @LastEditors  : Please set LastEditors
 * @LastEditTime : 2022-07-27 14:37:09
 * @FilePath     : \rpms\src\views\project\detail\components\descTabs\tab3.vue
-->
<template>
  <el-table
    :data="model.tableData"
    border
    style="width: 100%"
    :header-cell-style="{ background: '#eef1f6', color: '#606266' }"
  >
    <template #empty>
      <el-empty :image-size="50" description="暂无数据"></el-empty>
    </template>
    <el-table-column type="index" label="序号"> </el-table-column>
    <el-table-column prop="name" label="单位名称"></el-table-column>
    <el-table-column prop="legal" label="法人单位"></el-table-column>
    <el-table-column prop="type" label="单位类型"></el-table-column>
    <el-table-column prop="task" label="承担任务"></el-table-column>
    <el-table-column prop="role" label="单位角色"></el-table-column>
  </el-table>
</template>

<script lang="ts" setup>
// import { ref, reactive, onBeforeMount, unref, nextTick } from "vue";
import { onMounted, reactive, watch } from "vue";

const props = defineProps({
  projectInfo: {
    type: Object
  }
});
const model = reactive({
  tableData: []
});

onMounted(() => {
  model.tableData = JSON.parse(props.projectInfo?.projectUnderUnit) || [];
});

watch(
  () => props.projectInfo,
  newvalue => {
    model.tableData = JSON.parse(newvalue.projectUnderUnit) || [];
  },

  { immediate: false }
);
</script>
